import { defineConfig } from 'vite'
import  vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
import path from 'path'

// https://vite.dev/config/
export default defineConfig({
  plugins: [vue()],
  server:{
    host:'0.0.0.0',
    port:8081,
    hmr:true,
    open:true,
    proxy:{
      '/api':{
        target:'http://localhost:8089',
        changeOrigin:true,
        rewrite:(path:any) => path.replace(/^\/api/,'')//前端跨域
      }
    }
  },
  resolve:{
    alias:
    {
      find:'@',
      '@': path.resolve(__dirname, 'src'),
      replacement:resolve(__dirname,'src'),
      'vue': resolve(__dirname, 'node_modules/vue/dist/vue.esm-bundler.js'),
    }
  
  },
  define:{
    'process.env':{
      'BASE_API_IMG':'http://localhost:8089',
      'BASE_API':'http://localhost:8089'
    }
  },
  build:{
    chunkSizeWarningLimit:5000
  }
})
